Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send http.route attribute in flask metric #2506

Conversation

GonzaloGuasch
Copy link
Contributor

@GonzaloGuasch GonzaloGuasch commented May 7, 2024

Description

Taking up this closed PR, when sending metrics in the Flask instrumentation, the http.route attribute is added to them.
This attribute is super important in the use of metrics and will greatly improve the experience of using Flask. This change was tested locally.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

running: tox -e test-instrumentation-flask

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented May 7, 2024

CLA Missing ID CLA Not Signed

@GonzaloGuasch GonzaloGuasch requested a review from a team May 7, 2024 19:10
@github-actions github-actions bot requested a review from ocelotl May 7, 2024 19:14
@xrmx
Copy link
Contributor

xrmx commented May 8, 2024

@GonzaloGuasch please sign the CLA

@xrmx
Copy link
Contributor

xrmx commented May 8, 2024

@GonzaloGuasch please do all your commits from the same email that signed the CLA, see #2506 (comment)

@GonzaloGuasch GonzaloGuasch marked this pull request as draft May 8, 2024 18:06
@GonzaloGuasch
Copy link
Contributor Author

Changing the PR to draft until i resolve CLA certification with mi company!

@GonzaloGuasch GonzaloGuasch marked this pull request as ready for review June 14, 2024 19:44
@@ -47,6 +47,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- `opentelemetry-instrumentation-flask` Add http route to metric attributes
([#2506](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2506))
-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-

duration_histogram_old.record(
max(round(duration_s * 1000), 0), duration_attrs_old
)
if duration_histogram_new:
duration_attrs_new = otel_wsgi._parse_duration_attrs(
attributes, _HTTPStabilityMode.HTTP
)

if wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY, None):
duration_attrs_new[SpanAttributes.HTTP_ROUTE] = wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use the new semconv attribute here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by new semconv? To change the variable?
It is mandatory to have the key value "http.route"

Copy link
Member

@emdneto emdneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix lint

@xrmx
Copy link
Contributor

xrmx commented Jun 19, 2024

@GonzaloGuasch the CLA check is failing 😓

@GonzaloGuasch
Copy link
Contributor Author

Closing this PR due to contract problems 😭. Continue in this new #PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants